<?php 
include "../Lib/Common.php";
//---------= Start read schemal ----------------------------------------------------------------------------------------------
// database constants
// make sure the information is correct
define("DB_SERVER", DATABASE_HOST);
define("DB_USER", DATABASE_USER);
define("DB_PASS", DATABASE_PASSWORD);
define("DB_NAME", DATABASE_NAME);

// connection to the database
$dbhandle = mysql_connect(DB_SERVER, DB_USER, DB_PASS)
   or die("Unable to connect to MySQL");

// select a database to work with
$selected = mysql_select_db(DB_NAME, $dbhandle)
   or die("Could not select examples");

// return all available tables 
$result_tbl = mysql_query( "SHOW TABLES FROM ".DB_NAME, $dbhandle );

$tables = array();
while ($row = mysql_fetch_row($result_tbl)) {
   $tables[] = $row[0];
}

foreach ( $tables as $table ) {

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Create Admin Listing Page</title>
</head>

<body>

<br />
<form id="form1" name="form1" method="post" action="createAdminListPage.php" target="_blank">
	Select table for creating Listing Page: <select id="page" name="page">
	<?
	foreach ( $tables as $table ) {?>
		<option value="<?=$table?>"><?=$table?></option>
	<? } ?>
    </select>
    <br />
    <br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
    &nbsp; &nbsp; &nbsp; &nbsp;
    <input type=button value="Create" onClick="document.form1.action = 'createAdminListPage.php?t=' + document.form1.page.value; document.form1.submit();"/>
</form>
</body>
</html>